<?php

namespace api\modules\openapi\models;

use Yii;

/**
 * This is the model class for table "ad".
 *
 * @property integer $id
 * @property string $name
 * @property integer $status
 * @property integer $advertiser_id
 * @property integer $campaign_id
 * @property integer $template_id
 * @property string $images
 * @property string $title
 * @property string $description
 * @property string $logo
 * @property string $brand
 * @property string $click_url
 * @property string $audit_url
 * @property string $click_monitor_url
 * @property string $imp_monitor_url
 * @property integer $create_time
 * @property integer $update_time
 */
class Ad extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'ad';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('openapi');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'advertiser_id', 'campaign_id', 'template_id', 'images', 'click_url', 'create_time', 'update_time'], 'required'],
            [['status', 'advertiser_id', 'campaign_id', 'template_id', 'create_time', 'update_time'], 'integer'],
            [['name', 'title', 'description', 'brand'], 'string', 'max' => 100],
            [['images', 'logo', 'click_url', 'audit_url'], 'string', 'max' => 500],
            [['click_monitor_url', 'imp_monitor_url'], 'string', 'max' => 1024],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'name' => Yii::t('app', 'Name'),
            'status' => Yii::t('app', 'Status'),
            'advertiser_id' => Yii::t('app', 'Advertiser ID'),
            'campaign_id' => Yii::t('app', 'Campaign ID'),
            'template_id' => Yii::t('app', 'Template ID'),
            'images' => Yii::t('app', 'Images'),
            'title' => Yii::t('app', 'Title'),
            'description' => Yii::t('app', 'Description'),
            'logo' => Yii::t('app', 'Logo'),
            'brand' => Yii::t('app', 'Brand'),
            'click_url' => Yii::t('app', 'Click Url'),
            'audit_url' => Yii::t('app', 'Audit Url'),
            'click_monitor_url' => Yii::t('app', 'Click Monitor Url'),
            'imp_monitor_url' => Yii::t('app', 'Imp Monitor Url'),
            'create_time' => Yii::t('app', 'Create Time'),
            'update_time' => Yii::t('app', 'Update Time'),
        ];
    }
}
